﻿using System;
using System.Linq;
using System.Collections.ObjectModel;
using RiskMan.DataClass.Models.Plaza_II;
using RiskMan.DataClass;

namespace RiskMan.Config
{
    public class History
    {
        private Data _data;

        public History ( DataClass.Data _dataProvider )
        {
            this._data = _dataProvider;
        }

        #region Загрузка

        public void Load ( )
        {

            _data.RobotItemPlazaIIlist = GetRobotPlazaIIItems();
        }


        private ObservableCollection<RobotItemPlazaII> GetRobotPlazaIIItems()
        {
            return (ObservableCollection<RobotItemPlazaII>)XmlHistory.GetXmlData(XmlHistory.FilenamePlazaII);
        }
       

        #endregion

        #region Сохранение

        public void Save ( )
        {

            SetRobotRobotPlazaIIItem(_data.RobotItemPlazaIIlist);
        }


        private void SetRobotRobotPlazaIIItem(ObservableCollection<RobotItemPlazaII> observableCollection)
        {
            XmlHistory.SetXmlData(XmlHistory.FilenamePlazaII, (Object)(observableCollection.ToList()));
        }
      
        #endregion
    }
}